package com.coldtech.circlecrash.gui;

import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;

import com.coldtech.circlecrash.handler.ButtonHandler;

public class Button {
	public final static int NONE = 0;
	public final static int HOVERED = 1;
	public final static int PRESSED = 2;

	private int x, y, width, height, state;
	private boolean isClicked = false;
	private RoundRectangle2D.Double rect;

	public Button(ButtonHandler buttonHandler, int x, int y, int width,
			int height) {
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		isClicked = false;
		state = 0;

		rect = new RoundRectangle2D.Double(this.x, this.y, this.width,
				this.height, 17, 17);
		buttonHandler.addButton(this);
	}

	public RoundRectangle2D.Double getRectangle() {
		return rect;
	}

	public void draw(Graphics2D g) {

	}

	public boolean isOnButton(double x, double y) {
		if (rect.contains(x, y))
			return true;
		return false;
	}

	public void setClicked(boolean clicked) {
		isClicked = clicked;
	}

	public boolean clicked() {
		return isClicked;
	}

	public void setState(int state) {
		this.state = state;
	}

	public int getState() {
		return state;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}
}
